﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace 人事工资管理系统
{
    public partial class frmUserPay : Form
    {
        public frmUserPay()
        {
            InitializeComponent();
        }
        PMSClass.DBOperate operate = new PMSClass.DBOperate(); SqlConnection conn = PMSClass.DBConnection.MyConnection();

        private void frmUserPay_Load(object sender, EventArgs e)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * from tb_pay", conn);
            SqlDataReader sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                comboBox1.Items.Add(sdr["YID"].ToString());
                comboBox2.Items.Add(sdr["YMonth"].ToString());

            }
            sdr.Close();
            conn.Close();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string str = "select * from tb_pay where YID='" + comboBox1.Text + "'";
            DataSet ds = operate.GetTable(str);
            ds.Dispose();
            textBox1.Text = ds.Tables[0].Rows[0][2].ToString();
            textBox2.Text = ds.Tables[0].Rows[0][12].ToString();
            textBox3.Text = ds.Tables[0].Rows[0][13].ToString();
            textBox4.Text = ds.Tables[0].Rows[0][14].ToString();
           
        }
    }
}
